<template>
<view class="container">
 <searchbar clearButton="auto" confirm="onSearch"></searchbar>
  
  <text v-if="courseList.length==0" >加载中……</text>

    <block v-else v-for="item in courseList" v-key="id">
      
	  <videoitem :title='item.name'
      :note='item.author'
      :rightText='item.grade+item.subject'
      :thumb='item.cover'
	  :list='courseList'
	  :url='"../../pages/course/detail?cid="+item._id'
      ></videoitem>
	</block>
</view>
</template>

<script>
	import searchbar from '../../components/uni-search-bar/uni-search-bar.vue'
	import videoitem from '../../components/course-video/video-list-item.vue'
	const db = wx.cloud.database()
	export default {
		components:{
			videoitem,
			searchbar
		},
		data() {
			return {
				    courseList:[
				    
				    ],

				    ttl: "",
			}
		},
		onLoad() {
			db.collection('albums').where({
				visible:true
			}).field({
				name: true,
				author: true,
				grade: true,
				subject: true,
				cover: true,
				_id: true,
			  }).get({
				success:res=>{
					console.log(res)
					if(res.data.length===0){
						

					}else{
						this.courseList = res.data
					}
				},
			})
		},
		methods: {
			
		}
	}
</script>

<style>
.weui-cell_select {
padding-right: 16px;
border-bottom: 1rpx solid rgba(0,0,0,0.1);
  background-color:grey;
}
.weui-cells__title{
  text-align: center;
}

</style>
